/*
 * Copyright (c)  2018. FitzYang Inc.
 * acgs All rights reserved.
 */

package com.oak.interviewdemo.common;

import com.oak.interviewdemo.sys.entity.User;
import org.apache.shiro.SecurityUtils;

/**
 * <p> Controller公共组件</p>
 *
 * @version 1.0
 */
public abstract class AbstractController {

    /**
     * shiro组件获取用户信息
     *
     * @return
     */
    protected User getUser() {
        return (User) SecurityUtils.getSubject().getPrincipal();
    }

    protected int getUserId() {
        return getUser().getId();
    }
}
